@extends('layouts.admin')
@section('css')
    <link rel="stylesheet" href="{{asset('vendors/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css')}}">
@endsection
@section('content')
<div class="row wrapper border-bottom white-bg page-heading">
  <div class="col-lg-10">
    <h2>{!!trans('act/ticket.title')!!}</h2>
    <ol class="breadcrumb">
        <li>
            <a href="{{url('admin/dash')}}">{!!trans('admin/breadcrumb.home')!!}</a>
        </li>
        <li>
            <a href="{{url('act/ticket')}}">{!!trans('admin/breadcrumb.ticket.list')!!}</a>
        </li>
        <li class="active">
            <strong>{!!trans('admin/breadcrumb.ticket.edit')!!}</strong>
        </li>
    </ol>
  </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-lg-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5>{!!trans('act/ticket.edit')!!}</h5>
          <div class="ibox-tools">
              <a class="collapse-link">
                  <i class="fa fa-chevron-up"></i>
              </a>
              <a class="close-link">
                  <i class="fa fa-times"></i>
              </a>
          </div>
        </div>
        <div class="ibox-content">
          <form method="post" action="{{url('admin/ticket/'.$activity->id)}}" class="form-horizontal">
            {{csrf_field()}}
            {{method_field('PUT')}}
              <input type="hidden" name="id" value="{{$activity->id}}">
            <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.name')}}</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" name="name" value="{{old('name',$activity->name)}}" placeholder="{{trans('act/ticket.model.name')}}">
                @if ($errors->has('name'))
                <span class="help-block m-b-none text-danger">{{ $errors->first('name') }}</span>
                @endif
              </div>
            </div>
              <div class="hr-line-dashed"></div>
              <div class="form-group">
                  <label class="col-sm-2 control-label">{{trans('act/ticket.model.description')}}</label>
                  <div class="col-sm-10">
                      <input type="text" class="form-control" name="description" value="{{old('description',$activity->description)}}" placeholder="{{trans('act/ticket.model.description')}}">
                  </div>
              </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group{{ $errors->has('school') ? ' has-error' : '' }}">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.school')}}</label>
              <div class="col-sm-10">
                <input id="school-input" type="text" class="form-control" name="school" value="{{old('school',$activity->school)}}" placeholder="{{trans('act/ticket.model.school')}}" data-provide="typeahead">
                @if ($errors->has('school'))
                <span class="help-block m-b-none text-danger">{{ $errors->first('school') }}</span>
                @endif
              </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.location')}}</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" name="location" value="{{old('location',$activity->location)}}" placeholder="{{trans('act/ticket.model.location')}}">
                  @if ($errors->has('location'))
                      <span class="help-block m-b-none text-danger">{{ $errors->first('location') }}</span>
                  @endif
              </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.start_grab_date')}}</label>
              <div class="col-sm-10">
                <input type="text" class="form-control date-input" name="start_grab_date" value="{{old('start_grab_date',date('Y-m-d H:i',$activity->start_grab_date))}}" placeholder="{{trans('act/ticket.model.start_grab_date')}}">
                  @if ($errors->has('start_grab_date'))
                      <span class="help-block m-b-none text-danger">{{ $errors->first('start_grab_date') }}</span>
                  @endif
              </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.end_grab_date')}}</label>
              <div class="col-sm-10">
                <input type="text" class="form-control date-input" name="end_grab_date" value="{{old('end_grab_date',date('Y-m-d H:i',$activity->end_grab_date))}}" placeholder="{{trans('act/ticket.model.end_grab_date')}}">
                  @if ($errors->has('end_grab_date'))
                      <span class="help-block m-b-none text-danger">{{ $errors->first('end_grab_date') }}</span>
                  @endif
              </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.start_date')}}</label>
              <div class="col-sm-10">
                <input id="start_date" type="text" class="form-control date-input" name="start_date" value="{{old('start_date',date('Y-m-d H:i',$activity->start_date))}}" placeholder="{{trans('act/ticket.model.start_date')}}">
                  @if ($errors->has('start_date'))
                      <span class="help-block m-b-none text-danger">{{ $errors->first('start_date') }}</span>
                  @endif
              </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <label class="col-sm-2 control-label">{{trans('act/ticket.model.end_date')}}</label>
              <div class="col-sm-10">
                <input id="end_date" type="text" class="form-control date-input" name="end_date" value="{{old('end_date',date('Y-m-d H:i',$activity->end_date))}}" placeholder="{{trans('act/ticket.model.end_date')}}">
                  @if ($errors->has('end_date'))
                      <span class="help-block m-b-none text-danger">{{ $errors->first('end_date') }}</span>
                  @endif
              </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <div class="col-sm-4 col-sm-offset-2">
                  <a class="btn btn-white" href="{{url()->previous()}}">{!!trans('admin/action.actionButton.cancel')!!}</a>
                  <button class="btn btn-primary" type="submit">{!!trans('admin/action.actionButton.submit')!!}</button>
              </div>
            </div>
          </form>
        </div>
    </div>
  	</div>
  </div>
</div>
@endsection
@section('js')
    <script src="{{asset('vendors/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js')}}"></script>
    <script src="{{asset('admin/js/bootstrap3-typeahead.min.js')}}"></script>
    <script>
        $(function () {
            var $schoolInput = $('#school-input');
            var schoolData = [];
            $.get('/api/schools',function (data) {
                schoolData = data;
                $schoolInput.typeahead({
                    source: schoolData,
                    autoSelect: true
                });
            });
            $('.date-input').datetimepicker({
                format: 'yyyy-mm-dd hh:ii'
            });
        });
    </script>
@endsection